package org.polar.util;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;


public class DateUtil {  
	public final static String DATE_FORMAT = "yyyy-MM-dd HH:mm:ss";// 24Сʱ
	public final static String SQLITE_DATE_FORMAT = "'%Y-%m-%d %H:%M:%S'";
	private static SimpleDateFormat df = new SimpleDateFormat(DATE_FORMAT);
	public static String format(Date date){
		if(date == null){
			return null;
		}
		return df.format(date);
	}

	public static Date parse(String date) {
		if (date == null) {
			return null;
		}
		try {
			return df.parse(date);
		} catch (ParseException e) {
			return null;
		}
	}
}
